package com.qcby.train.mybaitsplusdemo.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qcby.train.mybaitsplusdemo.entity.Student;
import com.qcby.train.mybaitsplusdemo.entity.Teacher;
import com.qcby.train.mybaitsplusdemo.model.ResultJson;
import com.qcby.train.mybaitsplusdemo.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: TeacherController
 * @description:
 * @author: lxt
 * @create: 2021-04-26 20:38
 **/
@RestController
@RequestMapping("rest/teacher")
public class RestTeacherController {

    @Autowired
    private ITeacherService teacherService;


    /**
     *     @RequestMapping("listPage1")
     *     public ResultJson listPage1(int pageNo,int pageSize,Student student){
     *         Page<Student> page = new Page<>(pageNo,pageSize);
     *         IPage<Student> pageInfo = studentService.listPage1(page,student);
     *         return ResultJson.ok(pageInfo);
     *     }
     * @return
     */
    @GetMapping("listAll")
    public ResultJson listAll(int pageNo,int pageSize){
        Page<Teacher> page = new Page<>(pageNo,pageSize);
        IPage<Teacher> pageInfo = teacherService.listAll(page);
        return ResultJson.ok(pageInfo);
    }
}
